// ... 已有代码 ...
service.interceptors.request.use(
  config => {
    if (store.state.token) {
      config.headers.Authorization = `Bearer ${store.state.token}`
    }
    return config
  },
  error => {
    return Promise.reject(error)
  }
)
// ... 已有代码 ...